package ec.edu.udla.fichamedica.server.controller;

import java.util.List;

import ec.edu.udla.fichamedica.domain.Person;

public class PersonManager extends EntityManager<Person> {
	@Override
	public String getQuery() {
		return "SELECT p FROM "  +Person.class.getName()+" p WHERE p.deleted = ?1";
	}
	
	@Override
	public Boolean create(Person entity) {
		System.out.println("Creando entidad");
		entity.setDeleted(0);
		return super.create(entity);
	}
	
	@Override
	public Boolean update(Person entity) {
		
		System.out.println("modificando : "+entity.getId());
		return super.update(entity);
	}
	
	@Override
	public Boolean remove(Person entity) {
		System.out.println("eliminado : "+entity.getId());
		entity.setDeleted(1);
		return super.update(entity);
	}
	
	@Override
	public List<Person> getResults() {
		return super.getResults();
	}
	
}
